<?php echo $javascript->cacheEvents(false, true); ?>
<?php echo $javascript->codeBlock(); ?>
		$(document).ready(function()
		{
			$("#selectall").click(function()				
			{
				var checked_status = this.checked;
				$(".select-chekbox").each(function()
				{
					this.checked = checked_status; 
				});
			});					
		});
<?php echo $javascript->blockEnd(); ?>

<?php echo $form->create(array('action' => 'admin_delete_multiple_menu','method'=>'post', 'id' =>'admin_delete_multiple_menu', 'class' => '', 'enctype' => 'multipart/form-data')); ?>
 <div id="mws-container" class="clearfix">
  <div class="container">
            <div class="mws-panel grid_8">
      <div class="mws-panel-header"> <span class="mws-i-24 i-table-1">Sub Menu - Management</span> <span class="linktop"> 
	  <?php echo $this->Html->link('Add New SubMenu', array('controller'=>'setups', 'action' => 'admin_menu_item_create')); ?> </span> </div>
      <div class="mws-panel-body">
                <div class="dataTables_wrapper">
          <table class="mws-datatable-fn mws-table">
            <thead>
              <tr>
                <th class="sorting_asc" rowspan="1" colspan="1" style="width: 141px;"> 
				 <?php echo $form->input('',array('type' => 'checkbox' ,'id' =>'selectall', 'hiddenField' => false, 'class'=>'select-chekbox', 'label' => false)); ?>
                </th>
                <th class="sorting_asc" rowspan="1" colspan="1" style="width: 141px;"> <div class="colm-end">Sr No.</div></th>
                <th class="sorting" rowspan="1" colspan="1" style="width: 239px;">  <div class="colm-end">Menu Title</div></th>
                <th class="sorting" rowspan="1" colspan="1" style="width: 150px;"> <div class="colm-end">Parent Menu</div></th>
                <th class="sorting" rowspan="1" colspan="1" style="width: 91px;"> <div class="colm-end">Published</div></th>
                <th class="sorting" rowspan="1" colspan="1" style="width: 91px;"> <div class="colm-end">Parent Page</div></th>
                <th class="sorting" rowspan="1" colspan="1" style="width: 91px;"> <div class="colm-end">Actions</div></th>
              </tr>
            </thead>
            <?php if(isset($sub_menu_list) and ($sub_menu_list)): ?>
            <tbody>
            <?php  $x =0;
			
			  $x=1; foreach($sub_menu_list as $sub_menu){		//pr($Page);
				if($x%2==0)
				{
					$class ="odd";
				}
				else
				{
					$class ="even"; 
				}
				?>
              <tr class="gradeA <?php echo $class ; ?>">
                <td class=" sorting_1">	<?php echo $form->input('MenuItem.id'.'',array('type' => 'checkbox' ,'name' =>'data[checksel][]', 'hiddenField' => false, 'id' => 'checkselinput-'.$x, 'value'=>''.$sub_menu['MenuItem']['id'].'', 'class'=>'select-chekbox', 'label' => false)); ?>
</td>
                <td class=" sorting_1"><?php echo $x;?></td>
                <td class=" sorting_1">	<?php echo $sub_menu['MenuItem']['item_title'];?></td>
                <td  class=" sorting_1" valign="middle" align="center">  <?php echo $sub_menu['menu_name'];?></td>
                <td class="center">
					<?php if($sub_menu['MenuItem']['published']==1){ echo "Yes"; }else if($sub_menu['MenuItem']['published']==0){echo "NO";} ?>
                 </td>
                 <td>
                 <?php 
				 if($sub_menu['MenuItem']['parent_id']==0)
					{ 
						echo "Parent It Self";
					}
					else
					{
						echo $sub_menu['parent_type'];
					}
				?>
                </td>
                <td class="center">
				<?php echo $html->link('Edit', array('controller'=>'setups', 'action' => 'admin_menu_item_edit',$sub_menu['MenuItem']['id']), array('escape' => false));?>                              

				<?php
                                 echo $html->link('Delete',
                                 array('controller'=>'Setups', 'action' => 'admin_delete_by_id',
                                'MenuItem',$sub_menu['MenuItem']['id'],'admin_sub_menu_list'), array('escape' => false,'id'=>'alink'), 'Are you sure?');
                               
                   
                ?>
                	
                  </td>
              </tr>
              <?php $x++;} ?>
            </tbody>
            <?php endif; ?>
          </table>
          <div class="dataTables_info">   
              <input type="submit" onclick="return confirm('Are you sure to delete Selected Users?');" value="Delete Selected" class="delete_button_">
        </div>
          <div class="dataTables_paginate paging_full_numbers">
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
